package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Hcosmsyo type
*/
@SuppressWarnings("ALL")
public class Hcosmsyo {


        private static volatile Hcosmsyo instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Hcosmsyo getInstance() {
            if (instance == null) {
                synchronized (Hcosmsyo.class) {
                    if (instance == null) {
                        instance = new Hcosmsyo();
                    }
                }
            }
            return instance;
        }


        private Hcosmsyo() {

        }



    public  Boolean judgeBtygroqasm(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeQuqpupzros(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDcvipbzbht(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeJlppqzsngg(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeLavyylnmjw(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeWzbkvjebze(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeDxaxseiepb(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeFgkdoeuoea(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeBxedleczzp(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  btygroqasm;
    private String  quqpupzros;
    private String  dcvipbzbht;
    private String  jlppqzsngg;
    private String  lavyylnmjw;
    private String  wzbkvjebze;
    private String  dxaxseiepb;
    private String  fgkdoeuoea;
    private String  bxedleczzp;


    public void setBtygroqasm(String btygroqasm){
    this.btygroqasm = btygroqasm;
    }

    public String getBtygroqasm(){
    return this.btygroqasm;
    }
    public void setQuqpupzros(String quqpupzros){
    this.quqpupzros = quqpupzros;
    }

    public String getQuqpupzros(){
    return this.quqpupzros;
    }
    public void setDcvipbzbht(String dcvipbzbht){
    this.dcvipbzbht = dcvipbzbht;
    }

    public String getDcvipbzbht(){
    return this.dcvipbzbht;
    }
    public void setJlppqzsngg(String jlppqzsngg){
    this.jlppqzsngg = jlppqzsngg;
    }

    public String getJlppqzsngg(){
    return this.jlppqzsngg;
    }
    public void setLavyylnmjw(String lavyylnmjw){
    this.lavyylnmjw = lavyylnmjw;
    }

    public String getLavyylnmjw(){
    return this.lavyylnmjw;
    }
    public void setWzbkvjebze(String wzbkvjebze){
    this.wzbkvjebze = wzbkvjebze;
    }

    public String getWzbkvjebze(){
    return this.wzbkvjebze;
    }
    public void setDxaxseiepb(String dxaxseiepb){
    this.dxaxseiepb = dxaxseiepb;
    }

    public String getDxaxseiepb(){
    return this.dxaxseiepb;
    }
    public void setFgkdoeuoea(String fgkdoeuoea){
    this.fgkdoeuoea = fgkdoeuoea;
    }

    public String getFgkdoeuoea(){
    return this.fgkdoeuoea;
    }
    public void setBxedleczzp(String bxedleczzp){
    this.bxedleczzp = bxedleczzp;
    }

    public String getBxedleczzp(){
    return this.bxedleczzp;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}